package com.example.administrator.yunniuusedcar.holder;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import com.example.administrator.common.ui.BaseAdapterRV;
import com.example.administrator.common.ui.BaseHolderRV;
import com.example.administrator.yunniuusedcar.R;
import com.example.administrator.yunniuusedcar.model.mode_benn.InfoArticleListBean;

import java.util.List;


/**  文章列表  当日头条
 * Created by Administrator on 2017/12/15.
 */

public class MainInfoHolder extends BaseHolderRV<InfoArticleListBean> {   //MainInfoHeadBeen.DataArticleListBeen     InfoArticleListBean


    private RecyclerView recyclerView2;

    /**
     * 构造方法
     *
     * @param context     上下文对象
     * @param parent      指RecyclerView控件
     * @param adapter     适配器
     * //@param layoutResId RecyclerView的一个item布局文件
     *                    文章列表
     */
    public MainInfoHolder(Context context, ViewGroup parent, BaseAdapterRV<InfoArticleListBean> adapter) {
        super(context, parent, adapter, R.layout.item_recycleview);   //列表

    }

    @Override
    public void onFindViews(View itemView) {
        recyclerView2 = (RecyclerView) itemView.findViewById(R.id.recycler_view666);
    }

    @Override
    protected void onRefreshView(InfoArticleListBean bean1, int position) {
        bean = (InfoArticleListBean)bean1;   /// 强转
        List<InfoArticleListBean.DataX> data = (List<InfoArticleListBean.DataX>) bean.data;    //????

        recyclerView2.setLayoutManager(new LinearLayoutManager
                (context, RecyclerView.VERTICAL, false));

        //适配

    }

//            private void initUload() {
//                String ul = IHttpService.HOST_URL + "Article/getTop";
//                String vals = "324c41l+5prUictRCX6S5Y2gjmYZ5W5zK6nrvVSTdbbrVpaYVrAnqVROgVSHUW8";
//                OkHttpUtils.get().url(ul).addParams("sign", vals).build().execute(new StringCallback() {
//
//                    @Override
//                    public void onError(Call call, Exception e, int id) {
//                        Global.showToast("网络请求失败" + e.getMessage());
//
//                    }
//
//                    @Override
//                    public void onResponse(String response, int id) {
//                        Gson f = new Gson();
//                        MainInfoHeadBeen   maininfoB = f.fromJson(response, MainInfoHeadBeen.class);                   //
//
//                    }
//                });
//            }
}